home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Button;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.FlowLayout;
- import java.awt.GridLayout;
- import java.awt.Label;
- import java.awt.LayoutManager;
- import java.awt.Panel;
- import java.awt.TextField;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.net.URLEncoder;
- import java.util.EventObject;
-
- public class PasswordedDownload extends Applet implements ActionListener {
- public String url;
- public String title = "Enter the password";
- // $FF: renamed from: wi int
- private int field_0;
- // $FF: renamed from: he int
- private int field_1;
- private int frameWidth = 250;
- private int frameHeight = 150;
- // $FF: renamed from: t2 java.awt.TextField
- public TextField field_2;
- private String passwordText = "Password";
- private LoginFrame frame;
- private int wib;
- private int heb;
- private String text;
-
- public String getAppletInfo() {
- return "Name: PasswordedDownload\r\nAuthor: Taiji Software\r\n";
- }
-
- public void register() {
- try {
- URL u = new URL("http://www.taijisoftware.com");
- ((Applet)this).getAppletContext().showDocument(u, "_blank");
- } catch (Exception e) {
- System.out.println(e);
- }
- }
-
- public void init() {
- String codeBase = null;
-
- try {
- codeBase = (new URL(((Applet)this).getCodeBase().toString())).getHost();
- System.out.println("Copyright 1999, 2001 Taiji Software(tm)\nYour domain name is : " + codeBase);
- codeBase = codeBase.toUpperCase();
- } catch (Exception var9) {
- }
-
- if (!((Applet)this).getCodeBase().toString().toUpperCase().startsWith("FILE") || ((Applet)this).getParameter("debug") != null) {
- String regCode = ((Applet)this).getParameter("registration_code");
- if (regCode == null) {
- regCode = ((Applet)this).getParameter("reg_domain");
- if (regCode == null) {
- this.register();
- } else {
- if (regCode.length() == codeBase.length() + 4 && !codeBase.startsWith("WWW.")) {
- codeBase = "WWW." + codeBase;
- } else if (regCode.length() == codeBase.length() - 4 && codeBase.startsWith("WWW.")) {
- codeBase = codeBase.substring(4);
- }
-
- char[] chars = new char[codeBase.length()];
- codeBase.getChars(0, codeBase.length(), chars, 0);
- String key = new String("haricot");
- char[] chars2 = new char[key.length()];
- key.getChars(0, key.length(), chars2, 0);
-
- for(int i = 0; i < codeBase.length(); ++i) {
- int j;
- if (i >= key.length()) {
- j = i - key.length() * (i / key.length());
- } else {
- j = i;
- }
-
- chars[i] += chars2[j];
- chars[i] = (char)(chars[i] - chars[i] / 26 * 26 + 97);
- }
-
- String res = new String(chars);
- if (!res.equalsIgnoreCase(regCode)) {
- this.register();
- }
- }
- } else if (!regCode.equals("settevercsedegnamiaj") && !regCode.equals("8078")) {
- this.register();
- }
- }
-
- this.getParameters();
- this.putComponents();
- }
-
- public void stop() {
- this.frame.dispose();
- }
-
- public void getParameters() {
- this.field_0 = ((Component)this).getSize().width;
- this.field_1 = ((Component)this).getSize().height;
- String s = ((Applet)this).getParameter("button_width");
- if (s != null) {
- this.wib = Integer.parseInt(s);
- } else {
- this.wib = this.field_0;
- }
-
- s = ((Applet)this).getParameter("button_height");
- if (s != null) {
- this.heb = Integer.parseInt(s);
- } else {
- this.heb = this.field_1;
- }
-
- this.text = ((Applet)this).getParameter("button_text");
- s = ((Applet)this).getParameter("title");
- if (s != null) {
- this.title = s;
- }
-
- s = ((Applet)this).getParameter("frame_width");
- if (s != null) {
- this.frameWidth = Integer.parseInt(s);
- }
-
- s = ((Applet)this).getParameter("frame_height");
- if (s != null) {
- this.frameHeight = Integer.parseInt(s);
- }
-
- s = ((Applet)this).getParameter("password_text");
- if (s != null) {
- this.passwordText = s;
- }
-
- if (((Applet)this).getParameter("background_color") != null) {
- ((Component)this).setBackground(this.getColor("background_color"));
- }
-
- }
-
- public Color getColor(String param) {
- String s = ((Applet)this).getParameter(param);
- if (s != null) {
- if (s.substring(0, 1).equals("#")) {
- s = s.substring(1);
- int i = Integer.parseInt(s, 16);
- return new Color(i);
- } else {
- return null;
- }
- } else {
- return null;
- }
- }
-
- public void putComponents() {
- Button b = new Button(this.text);
- ((Container)this).setLayout((LayoutManager)null);
- ((Container)this).add(b);
- ((Component)b).setSize(this.wib, this.heb);
- ((Component)b).setLocation((this.field_0 - this.wib) / 2, (this.field_1 - this.heb) / 2);
- ((Component)b).setBackground(this.getColor("button_color"));
- b.addActionListener(this);
- }
-
- public void putComponents2() {
- this.frame = new LoginFrame(this.title, this);
- this.frame.setBounds(200, 200, this.frameWidth, this.frameHeight);
- this.frame.setLayout(new FlowLayout());
- Panel p1 = new Panel();
- ((Container)p1).setLayout(new GridLayout(1, 2));
- ((Container)p1).add(new Label(this.passwordText));
- this.field_2 = new TextField(10);
- this.field_2.setEchoChar('*');
- ((Container)p1).add(this.field_2);
- Panel p2 = new Panel();
- ((Container)p2).setLayout(new FlowLayout());
- Button b1 = new Button("Ok");
- b1.addActionListener(this.frame);
- ((Container)p2).add(b1);
- Button b2 = new Button("Cancel");
- b2.addActionListener(this.frame);
- ((Container)p2).add(b2);
- this.frame.add(p1);
- this.frame.add(p2);
- if (((Applet)this).getParameter("frame_background_color") != null) {
- this.frame.setBackground(this.getColor("frame_background_color"));
- } else {
- this.frame.setBackground(Color.gray);
- }
-
- this.frame.setVisible(true);
- }
-
- public void actionPerformed(ActionEvent evt) {
- Button var10000 = (Button)((EventObject)evt).getSource();
- this.putComponents2();
- }
-
- public URL giveURL(String url) {
- try {
- if (url.toUpperCase().startsWith("HTTP")) {
- return new URL(url);
- } else if (url.toUpperCase().startsWith("FTP")) {
- int p = url.indexOf(":");
- int p2 = url.indexOf(":", p + 1);
- if (p2 != -1) {
- url = url.substring(0, p + 3) + URLEncoder.encode(url.substring(p + 3, url.length()));
- }
-
- p = url.indexOf("%40");
- if (p != -1) {
- url = url.substring(0, p) + "@" + url.substring(p + 3, url.length());
- }
-
- return new URL(url);
- } else {
- return new URL(((Applet)this).getCodeBase(), url);
- }
- } catch (MalformedURLException e) {
- System.out.println(e);
- return null;
- }
- }
- }
-